package com.wsc.staticproxy.ver04;

import com.wsc.staticproxy.Movable;

/**
 * 聚合了 Movable 的代理类，可以代理任何实现了 Movable 接口的类
 */
public class TankTimeProxy implements Movable {

    Movable movable;

    public TankTimeProxy(Movable movable) {
        this.movable = movable;
    }

    @Override
    public void move() {
        long start = System.currentTimeMillis();
        movable.move();
        long end = System.currentTimeMillis();
        long time = end - start;
        System.out.println("坦克运行了："+ time + "ms");
    }
}
